package com.feng.annotation.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Lee
 * @date 2019/3/6
 */
@ComponentScan(value = "com.feng.annotation", useDefaultFilters = false,
        includeFilters = {
             @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class, ControllerAdvice.class})
        }
)
@EnableWebMvc
public class AppConfig extends WebMvcConfigurerAdapter {

        @Override
        public void configureViewResolvers(ViewResolverRegistry registry) {
                registry.jsp("/WEB-INF/views/", ".jsp");
        }

        @Override
        public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
                configurer.enable();
        }
}
